const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');

const MerchantInfo = sequelize.define('merchant_info', {
  merchant_name: {
    type: DataTypes.STRING(10),
    allowNull: false,
    primaryKey: true,
    comment: '商家名称'
  },
  taobao_id: {
    type: DataTypes.CHAR(9),
    allowNull: false,
    primaryKey: true,
    unique: true,
    comment: '淘宝ID',
    validate: {
      is: /^[0-9]{9}$/
    }
  }
}, {
  tableName: 'merchant_info',
  timestamps: true,
  createdAt: 'create_time',
  updatedAt: 'update_time'
});

module.exports = MerchantInfo; 